package com.dcy.builder.improve;

/**
 * @Author：dcy
 * @Description: 指挥者，这里指定制作流程
 * @Date: 2021/1/21 8:39
 */
public class HouseDirector {

    private HouseBuilder houseBuilder = null;

    /**
     * 构造器方式
     *
     * @param houseBuilder
     */
    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    /**
     * setter方式传入
     *
     * @param houseBuilder
     */
    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    //如何处理建造房子的流程，交给指挥者
    public House constructHouse() {
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.roofed();
        return houseBuilder.buildHouse();
    }
}
